package com.jet.chat.message;

import java.io.BufferedReader;
import java.io.IOException;

import com.jet.chat.exception.ChatException;

public class MessageReaderBufferedReader implements MessageReader {
	BufferedReader reader;
	
	public MessageReaderBufferedReader(BufferedReader reader) {
		this.reader = reader;
	}

	@Override
	public Message read() throws ChatException {
		try {
			return new Message(reader.readLine());
		} catch (IOException e) {
			throw new ChatException(e);
			//throw new ChatException("throw new MessageReaderBufferedInputStream");
		}
	}

}
